package com.mark.mall.admin.platform.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.github.pagehelper.PageInfo;
import com.mark.mall.admin.platform.dto.PageParamDTO;
import com.mark.mall.admin.platform.dto.ProductDTO;
import com.mark.mall.admin.platform.dto.ProductStockDTO;
import com.mark.mall.admin.platform.dto.param.ProductAddParam;
import com.mark.mall.admin.platform.dto.param.ProductUpdateParam;
import com.mark.mall.admin.platform.entity.Product;
import com.mark.mall.common.resultBean.R;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
/**
 * <p>
 * 物料表 服务类
 * </p>
 *
 * @author admin
 * @since 2021-02-28
 */
public interface ProductService extends IService<Product> {

    /**
     * 获取物料列表
     *
     * @param curPage
     * @param pageSize
     * @param code
     * @return
     */
    PageInfo<ProductDTO> getProductPage(int curPage, int pageSize, String code);

    /**
     * 物料新增
     * @param productAddParam
     * @return
     * @throws Exception
     */
    R<Boolean> addProduct(ProductAddParam productAddParam) throws Exception;

    /**
     * 物料删除
     * @param ids
     * @return
     * @throws Exception
     */
    R<Boolean> delProduct(String ids) throws Exception;

    /**
     * 物料上下架
     * @param ids
     * @param shelfState
     * @return
     * @throws Exception
     */
    R<Boolean> shelfProduct(String ids, String shelfState) throws Exception;

    /**
     * 物料修改
     * @param param
     * @return
     */
    R<Boolean> updateProduct(@Valid ProductUpdateParam param) throws Exception;

    /**
     * 根据id获取物料信息
     *
     * @param id
     * @return
     */
    Product getProductById(String id);

    /**
     * 获取物料关联库存以及上架数量
     *
     * @param pageParamDTO
     * @param code
     * @return
     */
    R<PageInfo<ProductStockDTO>> productStockPageInfo(PageParamDTO pageParamDTO, String code);

    /**
     * 物料出库
     * @param id
     * @param openNum
     * @return
     * @throws Exception
     */
    R<Boolean> openStock(String id, int openNum) throws Exception;

    /**
     * 物料入库
     * @param id
     * @param inNum
     * @return
     * @throws Exception
     */
    R<Boolean> inStock(String id, int inNum) throws Exception;

    /**
     * 物料主图上传
     *
     * @param file
     * @param id
     * @return
     * @throws Exception
     */
    R<Boolean> productMailImg(MultipartFile file, String id) throws Exception;
}
